package jp.co.showbiz.common.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class LoginFilter implements Filter {
	protected FilterConfig filterConfig = null;

	public void destroy() {
		filterConfig = null;
	}

	public void doFilter(ServletRequest req, ServletResponse res,
			FilterChain chain) throws IOException, ServletException {
		// HttpServletRequest httpReq = (HttpServletRequest) req;
		// HttpServletResponse httpRes = (HttpServletResponse)res;
		//
		// HttpSession session = httpReq.getSession();
		// String username = (String) session.getAttribute("username");
		// String path = httpReq.getServletPath();
		// if (username == null && !path.equals("/login.action") &&
		// !path.equals("/index.action")) {
		// String redirect = httpReq.getContextPath()+"/index.action";
		// httpRes.sendRedirect(redirect);
		// return;
		// }
		chain.doFilter(req, res);
	}

	public void init(FilterConfig fcon) throws ServletException {
		filterConfig = fcon;
	}

}
